package com.jdkj.tools.util;

import lombok.SneakyThrows;
import org.apache.http.Header;
import org.apache.http.message.BasicHeader;

import java.util.HashMap;

public class MoveFile {

    @SneakyThrows
    public static  void  moveFile(String fileKey,String projectKey,String folderId){
//        String key="EP202401";
        //请求 URL:
        //
        //http://192.168.11.7:8083/rest/raven/1.0/folderStructure/moveCreatedTestToFolder?entityKey=EP202401&folderId=5&testKey=EP202401-292

        StringBuffer url=new StringBuffer("http://192.168.11.7:8083/rest/raven/1.0/folderStructure/moveCreatedTestToFolder?").append("entityKey=").append(projectKey).append("&").append("folderId=")
                .append(folderId).append("&").append("testKey=").append(fileKey);
        System.out.println("移动文件请求url"+url);
        Header[] headers = new Header[]{new BasicHeader("Cookie", TokenConstant.JSESSIONID),
        new BasicHeader("Content-Type","\n" +
                "application/json;charset=UTF-8")};

        String result = HttpClientUtil.doPut(url.toString(), new HashMap<>(), headers);

        System.out.println("移动文件的请求"+result);
    }
}
